<template>
	<view :style="'width:' +windowWidth+'px;height:'+windowHeight+'px;'">
		<view class="status_bar">
			<!-- 这里是状态栏 -->
		</view>
		<view class="v-box" style="height: 100%;">
			<view class="h-flex" style="height: 100%;">
				<image src="../../static/selectImage.png" class="select-image" mode="aspectFit" @click="selectImage" />
				<image src="../../static/selectVideo.png" class="select-image" mode="aspectFit" @click="selectVideo" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				windowWidth: 100,
				windowHeight: 100,
			}
		},
		onShow() {
			plus.navigator.setFullscreen(false)
		},
		onLoad() {
			let systemInfo = uni.getSystemInfoSync()
			this.windowHeight = systemInfo.windowHeight
			this.windowWidth = systemInfo.windowWidth
		},
		onResize() {
			let systemInfo = uni.getSystemInfoSync()
			this.windowHeight = systemInfo.windowHeight
			this.windowWidth = systemInfo.windowWidth
		},
		methods: {
			selectImage() {
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: res => {
						uni.navigateTo({
							url: "../image/image?path=" + res.tempFilePaths[0],
						})
					}
				})
			},
			selectVideo() {
				uni.chooseVideo({
					sourceType: ['album'], //从相册选择
					success: res => {
						uni.navigateTo({
							url: "../video/video?path=" + res.tempFilePath+"&duration="+res.duration,
						})

					}
				})
			}
		}
	}
</script>

<style>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}
	.select-image{
		width: 100rpx;
		padding: 30rpx;
	}
</style>
